package com.qingzhu.util;

import sun.misc.BASE64Encoder;

import java.security.MessageDigest;

public class Md5Util {
    // 加密后的字符串
    private static String password;

    public static String getPassword(String str){
        try {
            // // 拿到一个MD5转换器
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            BASE64Encoder base64Encoder = new BASE64Encoder();
            password = base64Encoder.encode(md5.digest(str.getBytes("utf-8")));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return password;
    }
}
